# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: N30N <archlinux@alunamation.com>
# Contributor: linkmauve <linkmauve@linkmauve.fr>
# Contributor: mokkurkalve <xenofil@gmail.com>

pkgname=libkate
pkgver=0.4.1
pkgrel=6
pkgdesc="A karaoke and text codec for embedding in ogg"
url="https://wiki.xiph.org/OggKate"
license=('BSD')
arch=('x86_64')
depends=('libpng' 'libogg' 'python2')
makedepends=('pkg-config' 'git')
optdepends=('wxpython: for KateDJ'
            'liboggz: for KateDJ')
source=("$pkgname::git+git://git.xiph.org/users/oggk/kate.git#tag=kate-${pkgver}"
        0001-Fix-automake-warnings.patch)
sha512sums=('SKIP'
            '525d120cddd040441859f2783e6e566da631ba304074bfa40a34399879fc3053577e8e71ef804168aeef519fac62e205829b50a61d770cddd46f7dbfba660842')

prepare() {
  cd "${srcdir}/${pkgname}"
  patch -Np1 -i "${srcdir}/0001-Fix-automake-warnings.patch"
  ./autogen.sh
}

build() {
  cd "${srcdir}/${pkgname}"

  export PYTHON="/usr/bin/python2"
  sed "1s/python$/python2/" -i tools/KateDJ/KateDJ

  ./configure --prefix=/usr \
              --disable-static \
              --disable-doc
  make
}

package() {
  cd "${srcdir}/${pkgname}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  python2 -m compileall "${pkgdir}/usr/lib/python2.7/site-packages/kdj/"
}
